package com.heima.admin.job;

import com.heima.admin.feign.WemediaFeign;
import com.heima.admin.service.WemediaNewsAutoScanService;
import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.handler.annotation.XxlJob;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @author feng js
 */
@Component
public class WeMediaNewsAutoScanJob {

    @Autowired
    WemediaFeign wemediaFeign;

    @Autowired
    WemediaNewsAutoScanService wemediaNewsAutoScanService;

    @XxlJob("wemediaAutoScanJob")
    public ReturnT<String> autoScanJob(String parm) {

        List<Integer> list = wemediaFeign.findRelease();
        if (list != null && list.size() > 0) {
            for (Integer integer : list) {
                wemediaNewsAutoScanService.autoScanByMediaNewsId(integer);
            }
        }
        return ReturnT.SUCCESS;
    }

}
